<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<%@ include file="/module/orderField.jsp"%>

<style>

table label.error {
    margin-left: 5px;
    width: auto;
    display: inline;
    color: red;
}


</style>
<script>
$(document).ready(
					function() {
						$("#div1").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择老师',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							
							  if($("#fromSelect").val()==null||$("#fromSelect").val()==""){
								 alert("请选择一项");
								 return false;
							  }else{
								     var result = $.parseJSON('${studentListJson}');
							    	 var emid=$("#fromSelect").val()+"";
							    	 var emids = emid.split(","); 
							    	 var idsxm="";
							    	 var dbempids="";
							    	 
							    	  if("${logo==true}"){
									    	 for(j=0;j<emids.length;j++){
										    		 for (var i = 0; i < result.length; i++) {
														    if(emids[j]==result[i].empid){
														    	if(idsxm.length>0)idsxm+="、";
														    	idsxm+="("+result[i].xm+","+result[i].zgh+")";
														    	if(dbempids.length>0)dbempids+="、";
														    	dbempids+="("+result[i].xm+","+result[i].zgh+","+result[i].empid+")";
															    break;
															}
														
											         }
										      } 
							          }
							    	  
							    	  if("${logo==false}"){
								    		  for(j=0;j<emids.length;j++){
										    		 for (var i = 0; i < result.length; i++) {
														    if(emids[j]==result[i].emid){
														    	if(idsxm.length>0)idsxm+="、";
														    	idsxm+="("+result[i].xm+","+result[i].zgh+")";
														    	if(dbempids.length>0)dbempids+="、";
														    	dbempids+="("+result[i].xm+","+result[i].zgh+","+result[i].emid+")";
															    break;
															}
											         }
										      } 
							          }
							    	  $("#dbxm").val(idsxm);
							    	  $("#dbempids").val(dbempids);
									
								  /*   if(num>=2){
								      layer.alert("只能选择一项", {icon: 6});
								      return false;
								    } */
								 /*  var str=$("#fromSelect").val()+"";
								  var strs = str.split(","); 
								  for(i=0;i<strs.length;i++){ */
									/*   if(i==0){ */
										/*   $("#dbempid").val(strs[i]); */
                                    /*   } */
									 /*  if(i==1){
										  $("#dbzgh").val(strs[i]);  
									  } */
								 /*  } */
								
						         //$("#dbxm").val($("#fromSelect").find("option:selected").text()); 
								  //$("#dbempid").val($("#fromSelect").val());
								  $(this).dialog('close');
							  }
							  
							  
							  /* var mycars=$("#fromSelect").val();
							  var g= mycars.toString();
							  alert(g);
							  var strArry = mycars.split(',');
							  if(strArry.length>1){
								  alert("负责人只能选择一个");  
								  return false;
							  } */
							
							  
							}
						  }
						});

					});
	function showdiv() {
		$('#div1').dialog('open');
	}
</script>
</head>
<body>
     <form action="#" name="Form" id="Form" method="post">
       <input type="hidden" name="dbid" id="dbid"  value="${data.dbid}"/>
		<table cellpadding="0" cellspacing="0" border="0" class="table-border" width="95%">
			<tr >
				<td class="table-header" colspan="4" style="text-align: center;">班主任顶班申请审批</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 15%">申请人姓名：</td>
				<td class="table-contentTD" style="width: 35%">${data.xm}</td>
		
			    <td class="table-titleTD" style="width: 15%">申请人工号：</td>
				<td class="table-contentTD"  style="width: 35%">${data.zgh}</td>
			</tr>
			
			<tr>
				<td class="table-titleTD" style="width: 15%">申请日期：</td>
				<td class="table-contentTD"  style="width: 35%">${data.applydate1}</td>
			
				<td class="table-titleTD" style="width: 15%">状态：</td>
				<td class="table-contentTD"  style="width: 35%">
				    <c:if test="${data.states==0}">未提交 </c:if>
					<c:if test="${data.states==1}">审核中 </c:if> 
					<c:if test="${data.states==2}">审核通过 </c:if>
					<c:if test="${data.states==3}">审核退回</c:if>
			      </td>
			</tr>
			 <tr>
				<td class="table-titleTD" style="width: 15%">顶班人：</td>
				<td class="table-contentTD"   colspan="3">
			    <input type="hidden" name="dbempids" id="dbempids"   value="${data.dbempid}" />
				<input type="text" id="dbxm" name="dbxm" placeholder="顶班人"  style="width:70%"   readonly="readonly"  class="inputText"  value="${data.dbxm}"  class="required" />&nbsp;&nbsp;
				<input type="button" id="optionBtn" value="选择" class="inputButton" onclick="javascript:showdiv();" />
				</td>
			</tr>
			 <tr>
				<td class="table-titleTD" style="width: 15%">顶班开始日期：</td>
				<td class="table-contentTD"  style="width: 35%">${data.ksrq1}</td>
			
				<td class="table-titleTD" style="width: 15%">开始日期范围：</td>
				<td class="table-contentTD"  style="width: 35%">
				         <input type="radio" value="上午"  disabled="disabled" <c:if test="${data.ksrqfw=='上午'}">checked="checked"</c:if>/>上午
				 	     <input type="radio" value="下午"  disabled="disabled"  <c:if test="${data.ksrqfw=='下午'}">checked="checked"</c:if>/>下午
				</td>
			</tr>
			
		     <tr>
				<td class="table-titleTD" style="width: 15%">顶班结束日期：</td>
				<td class="table-contentTD"  style="width: 35%">${data.jsrq1}</td>
									
				<td class="table-titleTD" style="width: 15%">结束日期范围：</td>
				<td class="table-contentTD"  style="width: 35%">
				 	    <input type="radio" value="上午" disabled="disabled" <c:if test="${data.jsrqfw=='上午'}">checked="checked"</c:if>/>上午
				 	    <input type="radio" value="下午" disabled="disabled" <c:if test="${data.jsrqfw=='下午'}">checked="checked"</c:if>/>下午
				</td>
			</tr>
			<tr>
				<td class="table-titleTD">顶班事由：</td>
				<td class="table-contentTD" colspan="3">${data.reasons}</td>
			</tr>
			<tr>
				<td class="table-titleTD">备注：</td>
				<td class="table-contentTD" colspan="3">${data.remark}</td>
			</tr>
			<tr>
				<td class="table-titleTD">审核意见：</td>
				<td class="table-contentTD" colspan="3"><textarea rows="8" cols="150" name="auditresult"  placeholder="审核意见" id="auditresult" maxlength="2000" >${data.auditresult}</textarea></td>
			</tr>
		</table>
	</form>	
		<br />
		<table cellpadding="1" cellspacing="1" border="0" align="left">
			<tr>
			    <td><input type="button" id="btnThrough" value="审 核 通 过"  class="inputButton" style="text-align: center;"/></td>
				<td><input type="button" id="btnBack" value="审 核 退 回" class="inputButton" style="text-align: center;"/></td>
				<td><input type="button" id="returnBut"  class="inputButton" value="返回"  style="text-align: center;"/></td>
			</tr>
		</table>
		
		  <div id="div1" style="display: none;">
			<table cellpadding="0" cellspacing="0" border="0" class="table-border">
				  <tr>
					  	 <td style="clear:both; width: 70%">
					  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"/><font color="green">在此查找</font> <br/>
					  	   <br/><label style="color:red;">未选中:</label><br/>
					  	   <select name="fromSelect" id="fromSelect" multiple="multiple"  class="inputText" size="1"  multiple="false" style="width:220px; height: 250px;"
								ondblclick="moveField('fromSelect','toSelect');">
								          <c:if test="${logo==true}">       
												<c:forEach items="${List}" var="data">
										         <option value="${data.empid}">${data.xm}</option>
									           </c:forEach>
									       </c:if>
									         <c:if test="${logo==false}"> 
											        	<c:forEach items="${List}" var="data">
												       <option value="${data.emid}">${data.xm}</option>
											          </c:forEach>
									          </c:if>
							</select>
								<select name="sourseFromSelect2" id="sourseFromSelect2"   multiple="false" style="width: 220px; height: 150px; display: none;" >
											  <c:if test="${logo==true}">       
													<c:forEach items="${List}" var="data">
											         <option value="${data.empid}">${data.xm}</option>
										           </c:forEach>
									          </c:if>
									           <c:if test="${logo==false}"> 
											        	<c:forEach items="${List}" var="data">
												       <option value="${data.emid}">${data.xm}</option>
											          </c:forEach>
									          </c:if>
	  	                        </select>
						  </td>
  	              </tr>
			</table>
	    </div>
		
		<script>
		 
			$(document).ready(function() {
				  $("#btnThrough").click(function() {
					  
					  layer.confirm("您是否确定审核吗?",{icon : 3,title : '提示',skin : 'layer-ext-moon'},function(index) {
						  var dbxm=$("#dbxm").val();
						  if(dbxm.length==''){
								layer.alert("顶班人不能为空", {icon: 5});
								return false;
						  }
						  if(dbxm.length>9){
								layer.alert("顶班人只能允许一个", {icon: 5});
								return false;
						  }
						  document.Form.action ="${basePath}/bjxxClassWorkInstead/audit?states=2";
						  document.Form.submit(); 
					   },function(index) {
						    layer.close(index);
						});	
		 		  });
				
				  $("#btnBack").click(function() {
					  layer.confirm("您是否确定审核吗?",{icon : 3,title : '提示',skin : 'layer-ext-moon'},function(index) {
							  document.Form.action ="${basePath}/bjxxClassWorkInstead/audit?states=3";
							  document.Form.submit();
					  },function(index) {
						    layer.close(index);
						});	
		 		  });
				  
				  $("#returnBut").click(function() {
		 		 	  window.location.href='${basePath}/bjxxClassWorkInstead/index_admin';
		 		  });
			});
		</script>

</body>
</html>
